<?php
my_component_load('testing' , false);
my_component_load('paging' , false);  
my_component_load('a_rekomendasi_lembur' );
$task = isset($_GET['task']) ? $_GET['task'] : "";  
$id = isset( $_GET['id'] ) ? $_GET['id']:  0; 
$periode_id = isset( $_GET['periode_id'] ) ? $_GET['periode_id']:  0; 

$modulname = "Personalia _BN_ Waktu Kerja _BN_ Rekomendasi Lembur > 56 Jam";
 
if($_SERVER['REQUEST_METHOD'] == "POST" ){
	switch($task){ 
	case   "edit_page" :
		$validate =  rekomendasi_lembur_validate( $id  );
		if($validate){
			$errors = message_multi_error($validate);
			$content = $errors;
			$content .= form_create_rekomendasi_lembur($id, $periode_id); 
			generate_my_web($content,"","plain.php");
			exit; 
		}else{
			form_rekomendasi_lembur_submit($id);
			$content =  "Updated";
			generate_my_web($content,"","plain.php");
			exit;
		 }
		break; 
	case   "auto_create_page" :
		$validate =  auto_create_validate( $id, $periode_id); 
		if($validate){
			$errors = message_multi_error($validate);
			$content = $errors;
			$content .= form_auto_create_lembur($id, $periode_id); 
			generate_my_web($content,"","plain.php");
			exit; 
		}else{
			form_auto_create_submit($id, $periode_id); 
			$content =  "Updated";
			generate_my_web($content,"","plain.php");
			exit;
		 }
		break; 		
	}
}else{	
	if($task == "delete"){
		my_query("DELETE FROM a_rekomendasi_lembur WHERE rekomendasi_lembur_id = {$id} ");
		my_direct($_SERVER['HTTP_REFERER']);
	}elseif($task == 'edit'){	
		$title= ($id > '0' ) ?  "Perubahan data" : "Tambah data";
		facebox_page('index.php?com='.$_GET['com'].'&task=edit_page&id='.$id.'&periode_id='.$periode_id  , $title , 310	); 
	}elseif($task == "edit_page"){ 
		$content  = form_create_rekomendasi_lembur($id, $periode_id); 
		generate_my_web($content,"","plain.php");
		exit;
	}elseif($task == "daftar_lembur"){ 
		$pagename = $modulname;
		load_facebox_script();
		$content =  list_daftar_lembur($periode_id) ; 
	}elseif($task == 'auto_create'){	
		$title= ($id > '0' ) ?  "Perubahan data" : "Tambah data";
		facebox_page('index.php?com='.$_GET['com'].'&task=auto_create_page&id='.$id.'&periode_id='.$periode_id  , $title , 310	); 
	}elseif($task == "auto_create_page"){ 
		$content  = form_auto_create($id, $periode_id); 
		generate_my_web($content,"","plain.php");
		exit;		
	}else{ 
		$pagename = $modulname;
		load_facebox_script();
		$content =  list_rekomendasi_lembur($periode_id) ; 
	}
}
generate_my_web($content, $pagename );
?>